@page "/Admin/Menus"


@rendermode InteractiveServer
@attribute [Authorize(Roles = "Administrator")]
@attribute [UserNavigation("菜单设置")]
@attribute [TabItemOption(Text = "菜单设置", Icon = "fa-solid fas fa-bars")]

 
<Table TItem="Navigation"
            IsTree="true" OnTreeExpand="OnTreeExpand"
            IsFixedHeader="true"
            TreeNodeConverter="TreeNodeConverter" 
            ExtendButtonColumnWidth="200"  
            OnQueryAsync="OnQueryAsync"
            ShowToolbar="true"
            IsBordered="true" 
            IsStriped="true" 
            IsMultipleSelect="true"
            TreeIcon="fa-solid fa-chevron-circle-right" 
            OnSaveAsync="@NavigationService.SaveAsync"
            OnDeleteAsync="NavigationService.DeleteAsync">

   
    <TableColumns>
        <TableColumn @bind-Field="@context.Name" Filterable="true" Searchable="true" Width="200"></TableColumn>
        <TableColumn @bind-Field="@context.Order" Width="50" DefaultSort="true"  DefaultSortOrder="SortOrder.Asc" Sortable="true"></TableColumn>
        <TableColumn @bind-Field="@context.Icon" Width="50" Align="Alignment.Center">
            <Template Context="v">
                <i class="text-info cell-icon @v.Value"></i>
            </Template>
        </TableColumn>
        <TableColumn @bind-Field="@context.Url"></TableColumn>
        <TableColumn @bind-Field="@context.Category" Filterable="true"></TableColumn>
        <TableColumn @bind-Field="@context.Target" Filterable="true" Lookup="Targets"></TableColumn>
        <TableColumn @bind-Field="@context.IsResource" Filterable="true"></TableColumn>
  
    </TableColumns>
  <EditTemplate Context="v">
      <MenuEditor Value="v" ParementMenus="ParementMenus" Targets="Targets"  />
  </EditTemplate>
</Table>

 
 